<template>
  <!-- 作者信息 -->
  <div class="author-info">
    <div class="head-box" @click.stop="$router.push('/authorcenter/' + id)">
      <span class="pic">
        <img :src="img_url ? img_url : ''" alt="" />
      </span>
      <span class="nick">{{ name }}</span>
    </div>
    <div class="authentication" v-if="badge_url">
      <span>
        <img :src="badge_url" alt="" />
      </span>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    img_url: String,
    name: String,
    badge_url: String,
    id: [Number, String]
  }
}
</script>

<style lang="less" scoped>
.author-info {
  display: flex;
  justify-content: space-between;
  align-items: center;

  .head-box {
    display: flex;
    align-items: center;

    .pic {
      height: 40px;
      width: 40px;
      border-radius: 999px;
      overflow: hidden;

      img {
        height: 100%;
        width: 100%;
      }
    }
    .nick {
      font-size: 14px;
      color: #777;
      margin-left: 5px;
    }
  }
  .authentication {
    display: flex;
    align-items: center;

    span {
      height: 20px;
      height: 20px;

      img {
        height: 100%;
        width: 100%;
      }
    }
  }
}
</style>
